function onRequest() {
    var obj = $('form');
    var username = $("input[name='username']").val();
    var password = $("input[name='password']").val();
    $.ajax({
        url: "http://localhost:80/phalapi/public/index.php?s=App.User.Login",
        type: "POST",
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify({'username': username, "password": password}),
        dataType: "JSON",
        success: function (result) {
            if (username == '' || password == '') {
                alert("用户名或密码不能为空")
            } else {
                var is_login_data = result['data']['is_login'];
                if (is_login_data == true) {
                    obj.submit();
                } else {
                    alert("账号或者密码错误，请检查后再输入")
                }
                // console.log("data:" + is_login_data)
            }
        },
        error: function (msg) {
            alert("错误信息：" + msg);
        }
    })
}

function webchat_chkkeysend(event) {
    if (event.keyCode == 13) {
        onRequest();
    }
}